<template>
  <div class="mainList">
    <div class="searchMain">
      <div class="searchPos" :class="{'boxShow': searchHide}">
        <a-form ref="formSearchRef" :model="formSearch" v-if="columnsDistShow">
          <div class="form-main" :class="{'searchHide': searchHide}">
            <div class="form-item">
              <div class="searchTop-list tess">
                <a-select v-model="keywords_type"
                          style="width:165px"
                          :trigger-props='{trigger:"hover"}'
                          :bordered="false"
                          :options="keywordTypes"
                          default-value="keywords"
                          @change="(v)=>switchKeywordType(formSearch,v)">
                </a-select>
                <a-input v-model="formSearch[keywords_type??'keywords']" allow-clear placeholder="多个请用','割开"/>
              </div>
              <a-form-item :field="keywords_type" label="关键字" label-col-flex="90px"
                           style="display: none;"></a-form-item>
              <a-form-item field="waybill_no" label-col-flex="90px" label="提单号" class="searchTop-list">
                <a-input v-model="formSearch.waybill_no" allow-clear placeholder="请输入提单号"/>
              </a-form-item>
              <a-form-item field="service_ids" label-col-flex="90px" label="服务" class="searchTop-list">
                <a-cascader
                    v-model="formSearch.service_ids"
                    :allow-search="true"
                    :allow-clear="true"
                    placeholder="请选择服务"
                    :max-tag-count="1"
                    :field-names="{ key: 'value', title: 'label' }"
                    :filter-option="filterTreeNode"
                    :options="columnsDist.dicthelpApi_serviceGroup.data"
                    :virtualListProps="{height: 500,}"
                    :trigger-props="{'content-class':'service'}"
                    multiple
                ></a-cascader>
              </a-form-item>
              <a-form-item field="user_id" label-col-flex="90px" label="用户" class="searchTop-list">
                <a-select multiple v-model="formSearch.user_id" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_customer.data"
                          :field-names="{ value: 'id', label: 'nick' }"
                          placeholder="请选择用户" allow-clear allow-search :virtual-list-props="{height:200}"/>
              </a-form-item>
              <a-form-item field="main_name" label-col-flex="90px" label="主品名" class="searchTop-list">
                <a-input v-model="formSearch.main_name" allow-clear placeholder="请输入主品名"/>
              </a-form-item>
              <a-form-item field="user_level" label-col-flex="90px" label="用户等级" class="searchTop-list">
                <a-select multiple v-model="formSearch.user_level" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_customerGrade.data"
                          :field-names="{ value: 'id', label: 'name' }"
                          placeholder="请选择用户等级" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_customerGrade.data,'user_level','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_customerGrade.data,'user_level','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                </a-select>
              </a-form-item>
              <a-form-item field="supplier" label-col-flex="90px" label="供应商" class="searchTop-list">
                <a-select multiple v-model="formSearch.supplier" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_supplier.data"
                          :field-names="{ value: 'id', label: 'name' }"
                          placeholder="请选择供应商" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_supplier.data,'supplier','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_supplier.data,'supplier','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                </a-select>
              </a-form-item>
              <a-form-item field="taxwith" label="承运商" label-col-flex="90px" class="searchTop-list">
                <a-select v-model="formSearch.express_carrier" :max-tag-count="1" :options="columnsDist.dictObj.data.express_carrier"
                          :field-names="{ value: 'key', label: 'title' }"
                          placeholder="请选择承运商" allow-clear allow-search :virtual-list-props="{height:200}">
                </a-select>
              </a-form-item>
              <a-form-item label="国家" label-col-flex="90px" field="country_search" class="searchTop-list">
                <a-select multiple v-model="formSearch.country_search" :max-tag-count="1"
                          placeholder="请选择国家" allow-clear allow-search>
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dictObj.data.countrys,'country_search','key')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dictObj.data.countrys,'country_search','key')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  <a-option v-for="item in columnsDist.dictObj.data.countrys"
                            :value="item.key">{{ item.title }} - {{ item.key }}
                  </a-option>
                </a-select>
              </a-form-item>
              <a-form-item field="address_lib_detail_id_search" label-col-flex="90px" label="地址编码"
                           class="searchTop-list" v-if="!auditView">
                <a-select multiple v-model="formSearch.address_lib_detail_id_search" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_addressLibDetail.data"
                          :field-names="{ value: 'id', label: 'code' }"
                          placeholder="请选择地址编码" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_addressLibDetail.data,'address_lib_detail_id_search','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_addressLibDetail.data,'address_lib_detail_id_search','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                </a-select>
              </a-form-item>
              <a-form-item field="postcode" label="邮编" label-col-flex="90px" class="searchTop-list" v-if="!auditView">
                <a-input v-model="formSearch.postcode" allow-clear placeholder="请输入邮编"/>
              </a-form-item>
              <a-form-item field="pickup_depot_id" label="拣货站点" label-col-flex="90px" class="searchTop-list">
                <a-select multiple v-model="formSearch.pickup_depot_id" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_depot.data" :field-names="{ value: 'id', label: 'name' }"
                          placeholder="请选择拣货站点" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_depot.data,'pickup_depot_id','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_depot.data,'pickup_depot_id','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="pickup_depot_id" label="预约送仓" label-col-flex="90px" class="searchTop-list">
                <a-select multiple v-model="formSearch.to_depot_id" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_depot.data" :field-names="{ value: 'id', label: 'name' }"
                          placeholder="请选择预约送仓站点" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_depot.data,'to_depot_id','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_depot.data,'to_depot_id','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="attrs" label="物品属性" label-col-flex="90px" class="searchTop-list">
                <a-select multiple v-model="formSearch.attrs" :max-tag-count="1"
                          :options="columnsDist.dictObj.data.ShipmentAttrs"
                          :field-names="{ value: 'key', label: 'title' }"
                          placeholder="请选择物品属性" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dictObj.data.ShipmentAttrs,'attrs','key')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dictObj.data.ShipmentAttrs,'attrs','key')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="seller_id" label="销售代表" label-col-flex="90px" class="searchTop-list">
                <a-select multiple v-model="formSearch.seller_id" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_user.data" :field-names="{ value: 'id', label: 'nickname' }"
                          placeholder="请选择销售代表" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_user.data,'seller_id','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_user.data,'seller_id','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="finance_id" label="财务代表" label-col-flex="90px" class="searchTop-list">
                <a-select multiple v-model="formSearch.finance_id" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_user.data" :field-names="{ value: 'id', label: 'nickname' }"
                          placeholder="请选择财务代表" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_user.data,'finance_id','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_user.data,'finance_id','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="customer_service_id" label="客服代表" label-col-flex="90px" class="searchTop-list">
                <a-select multiple v-model="formSearch.customer_service_id" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_user.data" :field-names="{ value: 'id', label: 'nickname' }"
                          placeholder="请选择客服代表" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_user.data,'customer_service_id','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_user.data,'customer_service_id','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="organization_id" label="分公司" label-col-flex="90px" class="searchTop-list">
                <a-select multiple v-model="formSearch.organization_id" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_dept.data" :field-names="{ value: 'id', label: 'name' }"
                          placeholder="请选择分公司" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_dept.data,'organization_id','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_dept.data,'organization_id','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="depot_id" label="站点" label-col-flex="90px" class="searchTop-list">
                <a-select multiple v-model="formSearch.depot_id" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_depot.data" :field-names="{ value: 'id', label: 'name' }"
                          placeholder="请选择站点" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_depot.data,'depot_id','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_depot.data,'depot_id','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="taxwith" label="交税方式" label-col-flex="90px" class="searchTop-list">
                <a-select v-model="formSearch.taxwith" :max-tag-count="1" :options="columnsDist.dictObj.data.taxwith"
                          :field-names="{ value: 'key', label: 'title' }"
                          placeholder="请选择交税方式" allow-clear allow-search :virtual-list-props="{height:200}">
                </a-select>
              </a-form-item>
              <a-form-item field="exportwith" label="报关方式" label-col-flex="90px" class="searchTop-list">
                <a-select v-model="formSearch.exportwith" :max-tag-count="1"
                          :options="columnsDist.dictObj.data.exportwith" :field-names="{ value: 'key', label: 'title' }"
                          placeholder="请选择报关方式" allow-clear allow-search :virtual-list-props="{height:200}">
                </a-select>
              </a-form-item>
              <a-form-item field="created_by" label="创建者" label-col-flex="90px" class="searchTop-list">
                <a-select multiple v-model="formSearch.created_by" :max-tag-count="1"
                          :options="columnsDist.dicthelpApi_user.data" :field-names="{ value: 'id', label: 'nickname' }"
                          placeholder="请选择创建者" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,columnsDist.dicthelpApi_user.data,'created_by','id')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline"
                                  @click="handleInverse(columnsDist.dicthelpApi_user.data,'created_by','id')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="created_at" label="创建时间" label-col-flex="90px" class="searchTop-list">
                <a-range-picker
                    showTime
                    v-model="formSearch.created_at"
                    :time-picker-props="{
                        defaultValue:['00:00:00','23:59:59']
                        }"
                />
              </a-form-item>
              <a-form-item field="picking_at" label="拣货时间" label-col-flex="90px" class="searchTop-list">
                <a-range-picker
                    showTime
                    v-model="formSearch.picking_at"
                    :time-picker-props="{
                        defaultValue:['00:00:00','23:59:59']
                        }"
                />
              </a-form-item>
              <a-form-item field="delivered_at" label="签收时间" label-col-flex="90px" class="searchTop-list">
                <a-range-picker
                    showTime
                    v-model="formSearch.delivered_at"
                    :time-picker-props="{
                        defaultValue:['00:00:00','23:59:59']
                        }"
                />
              </a-form-item>
              <a-form-item field="is_audit" label="审计状态" label-col-flex="90px" class="searchTop-list"
                           v-if="auditView">
                <a-select multiple v-model="formSearch.is_audit" :max-tag-count="1" :options="auditType"
                          :field-names="{ value: 'value', label: 'label' }"
                          placeholder="请选择审计状态" allow-clear allow-search :virtual-list-props="{height:200}">
                  <template #header>
                    <div style="padding: 6px 12px;">
                      <a-space>
                        <a-checkbox :value="false"
                                    @change="handleSelectAll($event,auditType,'is_audit','value')">全选/清除
                        </a-checkbox>
                        <a-button size="mini" type="outline" @click="handleInverse(auditType,'is_audit','value')">反选
                        </a-button>
                      </a-space>
                    </div>
                  </template>
                  >
                </a-select>
              </a-form-item>
              <a-form-item field="costomer_fee_amount" label="应收金额" label-col-flex="90px" class="searchTop-list"
                           v-if="auth('finance:customerFee:index')">
                <a-input-number
                    v-model="formSearch.costomer_fee_amountMin"
                    allow-clear
                    placeholder="请输入"
                />
                <span class="p-1">~</span>
                <a-input-number
                    v-model="formSearch.costomer_fee_amountMax"
                    allow-clear
                    placeholder="请输入"
                />
              </a-form-item>
              <a-form-item field="supplier_fee_amount" label="应付金额" label-col-flex="90px" class="searchTop-list"
                           v-if="auth('finance:supplierFee:index')">
                <a-input-number
                    v-model="formSearch.supplier_fee_amountMin"
                    allow-clear
                    placeholder="请输入"
                />
                <span class="p-1">~</span>
                <a-input-number
                    v-model="formSearch.supplier_fee_amountMax"
                    allow-clear
                    placeholder="请输入"
                />
              </a-form-item>
              <a-form-item field="is_cost" label="销售成本" label-col-flex="90px" class="searchTop-list"
                           v-if="auth('finance:cost:index')">
                <a-select v-model="formSearch.is_cost" :max-tag-count="1"
                          placeholder="请选择销售成本" allow-clear>
                  <a-option :value="1">无成本</a-option>
                  <a-option :value="2">有成本</a-option>
                </a-select>
              </a-form-item>
              <a-form-item field="pick_type" label="拣货状态" label-col-flex="90px" class="searchTop-list">
                <a-select v-model="formSearch.pick_type" :max-tag-count="1"
                          placeholder="请选拣货状态" allow-clear>
                  <a-option :value="1">已转运未拣货</a-option>
                </a-select>
              </a-form-item>
              <a-form-item field="end_delivery_type" label="末端派送" label-col-flex="90px" class="searchTop-list">
                <a-select v-model="formSearch.end_delivery_type" :max-tag-count="1" :options="columnsDist.dictObj.data.endDeliveryType"
                          :field-names="{ value: 'key', label: 'title' }"
                          placeholder="请选择末端派送" allow-clear allow-search :virtual-list-props="{height:200}">
                </a-select>
              </a-form-item>
            </div>
            <div class="form-buttom">
              <div>
                <a-button type="primary" html-type="submit" @click="submitSearch" style="margin-right: 10px;">
                  <template #icon>
                    <icon-search/>
                  </template>
                  搜索
                </a-button>
                <a-button @click="resetSearch">
                  <template #icon>
                    <icon-delete/>
                  </template>
                  重置
                </a-button>
              </div>
              <a-space class="lg:mt-0 mt-2"
                       style="margin-top: 20px;display: flex;justify-content: flex-end;margin-right: 10px">
                <a-tooltip content="显隐搜索">
                  <a-button shape="circle" @click="searchHide=!searchHide" style="margin-right: 10px">
                    <icon-search/>
                  </a-button>
                </a-tooltip>
                <a-tooltip content="设置">
                  <a-button shape="circle" @click="openSetting">
                    <icon-settings/>
                  </a-button>
                </a-tooltip>
              </a-space>
            </div>
          </div>

          <div class="touHide" style="display: flex;justify-content: center;margin-bottom: 10px;">
            <a-link v-if="searchHide" @click="searchHide=!searchHide" size="small">
              {{ searchHide ? '收起' : '' }}
              <template #icon>
                <icon-up v-if="searchHide"/>
              </template>
            </a-link>
          </div>
        </a-form>
      </div>
    </div>
    <div class="ma-content-block justify-between p-4 mainTable">

      <!-- 操作按钮 -->
      <div class="top-button">
        <div>
          <a-button type="primary" @click="addAction()">
            <template #icon>
              <icon-plus/>
            </template>
            新增
          </a-button>
          <ExeclFile/>
          <!-- <a-dropdown trigger="hover" :popup-max-height="false">
            <a-button type="secondary">
              <template #icon>
                <icon-upload/>
              </template>
              导入
            </a-button>
            <template #content>
              <a-doption @click="importList('shipment_excel')">单个运单</a-doption>
              <a-doption @click="importList('shipment_excel_batch')">批量导入</a-doption>
              <a-doption @click="importList('shipment_excel_batch_draft')">批量草稿</a-doption>
            </template>
          </a-dropdown> -->
          <a-dropdown trigger="hover" :popup-max-height="false">
            <a-button type="secondary">
              <template #icon>
                <icon-upload/>
              </template>
              导入
            </a-button>
            <template #content>
              <a-doption @click="importImport('shipment_excel')">单个运单</a-doption>
              <a-doption @click="importImport('shipment_excel_batch')">批量导入</a-doption>
              <a-doption v-auth="['document:shipment:shipment_excel_batch_draft']" @click="importImport('shipment_excel_batch_draft')">批量草稿</a-doption>
            </template>
          </a-dropdown>
          <download v-if="auditView" url="document/shipment/export" type="shipment"
                    :auth="['document:shipment:export']"/>
          <download v-else url="document/shipment/export" type="shipment" :auth="['document:shipment:export']"/>
          <a-button type="secondary" @click="printListTap"> 
            打印
          </a-button>
          <a-button type="secondary" @click="synchronous" :auth="['document:shipment:synchronous']">
            <template #icon>
              <icon-refresh/>
            </template>
            同步
          </a-button>
        </div>
        <a-space class="lg:mt-0 mt-2">
          <a-tooltip content="显隐搜索">
            <a-button shape="circle" @click="searchHide=!searchHide">
              <icon-search/>
            </a-button>
          </a-tooltip>
          <a-tooltip content="设置">
            <a-button shape="circle" @click="openSetting">
              <icon-settings/>
            </a-button>
          </a-tooltip>
        </a-space>

      </div>
      <!-- tab切换 -->
      <a-tabs class="ma-tabs mb-1 tabs" @change="clickTap" v-model:active-key="formSearch.status">
        <a-tab-pane :key="item.key" :title="item.title" v-for="item in shipmentTabs">
          <template #title>
            <slot :name="'tabTitle-' + item.label">{{ item.title }}{{ item.count ? `(${item.count})` : '' }}</slot>
          </template>
        </a-tab-pane>
      </a-tabs>

      <!-- 状态按钮 -->
      <div style="display: flex;">
        <button-group :button-groups="buttonGroups" :dataList="dataList" :crud-ref="crudRef" :selected="selected"
                      :currentStatus="currentStatus"/>
        <button-group-fee :button-groups="buttonGroupForFees"
                          :dataList="dataList" :crud-ref="crudRef" :selected="selected"
                          :currentStatus="currentStatus"/>
        <a-dropdown trigger="hover" :popup-max-height="false">
          <a-button style="margin:0px 10px 0 0;" type="primary" size="small"
                    v-auth="['document:shipment:merge','document:shipment:split']">逻辑合并
          </a-button>
          <template #content>
            <a-doption @click="mergeShipment()" v-auth="['document:shipment:merge']">
              合并运单
            </a-doption>
            <a-doption @click="splitShipment()" v-auth="['document:shipment:split']">
              取消合并
            </a-doption>
          </template>
        </a-dropdown>
        <a-dropdown trigger="hover" :popup-max-height="false">
          <a-button style="margin:0px 10px 0 0;" type="primary" size="small"
                    v-auth="['document:shipment:searchMerge','document:shipment:searchSplit']">查询合并
          </a-button>
          <template #content>
            <a-doption @click="searchMerge()" v-auth="['document:shipment:searchMerge']">
              合并运单
            </a-doption>
            <a-doption @click="searchSplit()" v-auth="['document:shipment:searchSplit']">
              取消合并
            </a-doption>
          </template>
        </a-dropdown>
        <totalPage ref="totalPage" :auth="['document:shipment:listTotal']" :api="shipment.listTotal" />
      </div>
      <div ref="tablePrantRef">
        <a-table ref="tableRef" :sticky-header="true" :scrollbar="true" :stripe="true" :scroll="{ x: '100%', y: '100%' }"  :columns="localColumns(columnsData,formSearch.status,'shipment')" :data="dataList" class="table-list"
                hide-expand-button-on-empty :loading="loading" row-key="id" @selection-change="setSelecteds($event)"
                :row-selection="rowSelection" v-model:selectedKeys="selected" column-resizable :pagination="false">
          <!--  列表插槽    -->
          <template #tr="{ record }">
            <tr
                class="ma-crud-table-tr"
                @dblclick="editAction(record)"
            />
          </template>
          <template #shipment_no="{ record }">
            <a-link :style="{ color: record.created_by == 1 ? 'orange' : 'blue', padding: '0' }"  style="padding:0" @click="editAction(record)">
              {{ record.shipment_no }}
              <a-tag color="red" v-if="record.id==record.merge_id">主</a-tag>
              <a-tag color="green" v-if="record.merge_id > 0 && record.id!=record.merge_id">子</a-tag>
            </a-link>
            <div class="overflow-hidden text-xs line-clamp-2">
              <div v-if="record.client_reference">{{ record.client_reference }}</div>
              <div v-if="record.self_reference">{{ record.self_reference }}</div>
              <div v-if="record.reference_1">{{ record.reference_1 }}</div>
              <div v-if="record.reference_2">{{ record.reference_2 }}</div>
              <div v-if="record.ext_number">
                <div v-for="(ext,i) in record.ext_number.split(',')">
                  {{ ext }}
                </div>
              </div>    
            </div>
            <div v-if="record.attachment_count">
                <a-link @click="" status="danger">
                  <template #icon>
                    <icon-file />
                  </template>
                </a-link>
              </div>
            <a-link status="danger" v-if="record.work_order">
              <template #icon>
                <icon-stop/>
              </template>
              问题件
            </a-link>
            <a-link status="danger" v-if="record.work_order && record.work_order.intercept == 1">
              <template #icon>
                <icon-stop/>
              </template>
              拦截
            </a-link>
          </template>
          <template #waybill_info="{ record }" >
            <div v-if="record.waybill_info.length>0">
              <div>{{ record.waybill_info[0]?.public_number }}</div>     
              <div class="overflow-hidden text-xs line-clamp-2" v-auth="['document:waybill:number']">{{ record.waybill_info[0]?.number }}</div>
            </div>
          </template>     
          <template #user="{ record }">{{ record.user?.username }}</template>
          <template #name="{ record }">{{ record?.address?.name ?? '' }}</template>
          <template #address_lib_detail_id="{ record }"
                    v-if="columnsDistShow">{{ getDictData('attrApi', 'dicthelpApi_addressLibDetail', record.address.address_lib_detail_id, 7, columnsDist) }}
          </template>

          <template #country="{ record }">{{ record.address?.country ?? '' }}
            <div style="text-overflow:ellipsis;white-space:nowrap;overflow: hidden;width: 60px;">
              {{ record.address?.postcode ?? '' }}
            </div>

          </template>
          <template #waybill_id="{ record }">{{ record.waybill_info?.number ?? record.waybill_info?.public_number ?? '-' }}
          </template>

          <template #end_delivery_type="{ record }"
                    v-if="columnsDistShow">{{ getDictData('dictObj', 'endDeliveryType', record.end_delivery_type, 2, columnsDist) }}
          </template>
          <template #status="{ record }" v-if="columnsDistShow">{{getDictData('dictObj','shipment_parcel_type',record.status,2,columnsDist) }}</template>
          <template #to_depot_id="{ record }"
                    v-if="columnsDistShow">{{ getDictData('attrApi', 'dicthelpApi_depot', record.info.to_depot_id, 3, columnsDist) }}
          </template>
          <template #pickup_depot_id="{ record }"
                    v-if="columnsDistShow">{{ getDictData('attrApi', 'dicthelpApi_depot', record.info.pickup_depot_id, 3, columnsDist) }}
          </template>
          <template #depot_id="{ record }"
                    v-if="columnsDistShow">{{ getDictData('attrApi', 'dicthelpApi_depot', record.depot_id, 3, columnsDist) }}
          </template>
          <template #user_level="{ record }"
                    v-if="columnsDistShow">{{ getDictData('attrApi', 'dicthelpApi_customerGrade', record.user?.grade_id ?? '', 3, columnsDist) }}
          </template>

          <template #seller_id="{ record }"
                    v-if="columnsDistShow">{{ getDictData('attrApi', 'dicthelpApi_user', record.seller_id, 4, columnsDist) }}
          </template>
          <template #finance_id="{ record }"
                    v-if="columnsDistShow">{{ getDictData('attrApi', 'dicthelpApi_user', record.finance_id, 4, columnsDist) }}
          </template>
          <template #customer_service_id="{ record }"
                    v-if="columnsDistShow">{{ getDictData('attrApi', 'dicthelpApi_user', record.customer_service_id, 4, columnsDist) }}
          </template>
          <template #exportwith="{ record }"
                    v-if="columnsDistShow">
                    <div :style="{color:(record.clearance?.exportwith=='1' ?'#f00':'')}">
                      {{ getDictData('dictObj', 'exportwith', record.clearance?.exportwith, 2, columnsDist) }}
                    </div>
          </template>
          <template #organization_id="{ record }"
                    v-if="columnsDistShow">{{ getDictData('attrApi', 'dicthelpApi_dept', record.organization_id, 3, columnsDist) }}
          </template>
          <template #wv_rate="{ record }">{{ record.volume_weight?.wv_rate ?? '' }}</template>
          <template #charge_weight="{ record }">{{ record.charge_weight_last ?? '' }}</template>
          <template #client_weight="{ record }">{{ record.volume_weight?.client_weight ?? '' }}</template>
          <template #client_volume="{ record }">{{ record.volume_weight?.client_volume ?? '' }}</template>
          <template #actual_weight="{ record }">{{ record.volume_weight?.actual_weight ?? '' }}</template>
          <template #actual_volume="{ record }">{{ record.volume_weight?.actual_volume ?? '' }}</template>
          <template #actual_volume_weight="{ record }">
            <div>{{ record.volume_weight?.actual_volume_weight ?? '' }}</div>
            <div>{{ record.volume_weight?.volume_weight_radix ?? '' }}</div>
          </template>
          <template #declaration_value="{ record }">
            {{ record.clearance?.declaration_currency ?? '' }}
            {{ record.clearance?.declaration_value ?? '' }}
          </template>
          <template #income="{ record }">
            <template v-if="record.flow && columnsDistShow">
              <fee-item :total="record.flow.income" :list="record.flow.incomelist"
                        :audit="record.info?.income_audit == 1"/>
            </template>
          </template>
          <template #expense="{ record }">
            <template v-if="record.flow && columnsDistShow">
              <fee-item :total="record.flow.expense" :list="record.flow.expenselist"
                        :audit="record.info?.expense_audit == 1"/>
            </template>
          </template>
          <template #cost="{ record }">
            <template v-if="record.flow && columnsDistShow">
              <fee-item :total="record.flow.cost" :list="record.flow.costlist" :audit="record.info?.cost_audit == 1"/>
            </template>
          </template>
          <template #bonus="{ record }">
            <template v-if="record.flow && columnsDistShow">
              <fee-item :total="record.flow.bonus" :list="record.flow.bonuslist" :audit="record.info?.bonus_audit == 1"/>
            </template>
          </template>
          <template #remark="{ record }"><div style="color: #f00;">{{ record.info?.remark}}</div></template>
          <template #internal_remark="{ record }"><div style="color: #f00;">{{ record.info?.internal_remark}}</div></template>
          <template #supplier_desc="{ record }">
            <p>{{record.third_order?.supplier.name}}</p>
            <p>{{record.third_order?.channel?.label}}</p>
            <p>{{record.third_order?.number}}</p>
          </template>
          <template #carrier="{ record }">
            <p>{{record.ups_carrier?.outer_carrier_code}}</p>
            <p v-if="record.ups_carrier!=null && record.ups!=null"><a-link :href="carrerLink(record)" target="_blank">{{record.ups[0]}}</a-link></p>
          </template>
        </a-table>
      </div>
      <!-- 分页 -->
      <div class="foot-list">
        <a-pagination
            :total="pageInfo.total"
            show-total show-jumper show-page-size
            v-model:current="formSearch.page"
            @change="pageChange"
            :page-size-options="[10, 20, 30, 50, 100]"
            @page-size-change="pageSizeChange"
            :page-size="formSearch.pageSize"
            style="display: inline-flex"
        />
      </div>
      <add-modal-form ref="addModalMormRef" @addClick="tableList" v-if="columnsDistShow"></add-modal-form>
      <shipmentInfo ref="shipmentInfo"></shipmentInfo>
      <add-modal ref="addModalRef"></add-modal>
      <setting ref="settingRef"></setting>
      <file-import ref="fileimportRef" @addClick="tableList"/> 
      <print-list ref="printListRef"/> 
    </div>
  </div>

</template>
<script setup>
import {ref, reactive, provide, computed, onMounted, nextTick, h, render, watch} from 'vue'
import shipment from '@/api/document/shipment'
import tag from '@/api/logistics/tag'
import {Message, Modal} from '@arco-design/web-vue'
import ShipmentInfo from "./shipmentInfo.vue";
import Setting from "@/views/components/setting.vue";
import dictHelp from "@/utils/dicthelp.js";
import useShipment from "@/utils/crud/useShipment.js";
import route from "@/api/routes/route";
import waybill from "@/api/document/waybill.js";
import delivery from "@/api/warehouse/delivery.js";
import printLabel from "@/api/logistics/printLabel.js";
import AddModal from "@cps/actionsNew/addModal.vue";
import AddModalForm from "@cps/actionsNew/addModalForm.vue";
import commonApi from '@/api/common'
import tool from '@/utils/tool'
import {useRouter, useRoute} from "vue-router";
import ButtonGroup from "@cps/actionsNew/buttonGroup.vue";
import ButtonGroupFee from "@cps/actionsNew/buttonGroupForFees.vue";
import workOrder from '@/api/logistics/workOrder'
import Download from "@/views/components/downloadNew.vue";
import ExeclFile from "@/views/components/ExeclFile.vue";
import customerFee from '@/api/finance/customerFee.js';
import Cost from '@/api/finance/cost.js';
import Bonus from '@/api/finance/bonus.js';
import supplierFee from '@/api/finance/supplierFee.js';
import uploadConfig from '@/config/upload'
import FeeItem from "@/views/document/shipment/FeeItem.vue";
import {getDictData} from "@/utils/crud/dictNew.js";
import {isUndefined, xor,} from 'lodash'
import {localColumns,tablePrantRefHeight} from "@/utils/crud/culmns.js";
import {auth, role} from '@/utils/common'
import TotalPage from "@/views/components/totalPage.vue";
import fileImport from "@/views/components/fileImport.vue";
import printList from "@/views/components/printList.vue";

const crudRef = ref()
const shipmentInfo = ref()
const selected = ref([])
const addModalMormRef = ref()
const tableRef = ref()
const tablePrantRef = ref() //tabel 父级高度
const dataList = ref([])
const loading = ref(false)
const addModalRef = ref()
const totalPage = ref()
const columnsDistShow = ref(false) //字典有没有加载完
const fileimportRef=ref()
const printListRef=ref()
import { updateQuery,getQuery } from '@/hooks/useQuery';

const carrerLink = (record) =>{
  let ups_carrier = record.ups_carrier
  if(!record.ups_carrier){
    return '';
  }
  if(ups_carrier.outer_carrier_code.toUpperCase() == 'UPS'){
    return 'https://wwwapps.ups.com/WebTracking/track?loc=zh_CN&track.x=Track&trackNums='+record.ups[0];
  }
  if(ups_carrier.outer_carrier_code.toUpperCase() == 'FEDEX'){
    return 'https://www.fedex.com/apps/fedextrack/?tracknumbers='+record.ups[0]+'&cntry_code=cn';
  }
  if(ups_carrier.outer_carrier_code.toUpperCase() == 'DPD'){
    return 'https://tracking.dpd.de/parcelstatus?query='+record.ups[0]+'&locale=en_D2';
  }
  if(ups_carrier.outer_carrier_code.toUpperCase() == 'OULALA'){
    return 'http://www.oulala-express.com/Search/index2.html?trackNo='+record.ups[0];
  }
  return ''
}
  
const currentStatus = computed(() => {
  // if (!crudRef.value) {
  //   return null
  // }
  let requestParams = formSearch
  if (!requestParams.status) {
    return null;
  }
  return requestParams.status
})
const router = useRouter()
const auditView = computed(() => {
  return router.currentRoute.value.fullPath.includes('shipmentAudit')
})
provide('getDictData', getDictData)
const shipmentTabs = ref([])//tabs赋值
const countList = ref({})
watch([shipmentTabs, countList],
    (newValues) => {
      if (shipmentTabs.value != '' && countList.value != '') {
        shipmentTabs.value.forEach(function (item) {
          item.count = countList.value[item.key] ? countList.value[item.key] : 0
        })
      }
    }
)
//树结构过滤
const filterTreeNode = (searchValue, nodeData) => {
  return nodeData.label.toLowerCase().indexOf(searchValue.toLowerCase()) > -1 ||
      nodeData.value.toString().toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
}

//获取权限
const authNode = (authList) => {
  let authAdu = true
  authList.map(item => {
    if (authAdu) {
      authAdu = auth(item)
    }
  })
  return authAdu
}


const columnsData = ref([
  {title: '运单号', dataIndex: 'shipment_no',slotName: 'shipment_no',fixed: 'left',width:150,hide:true,},
  {title: '用户', dataIndex: 'user',slotName: 'user',fixed: 'left',width:100,align:'center',hide:true,
    render: ({record}) => {
      return record.user?.nick || record.username
    }
  },
  {title: '用户等级', dataIndex: 'user_level',slotName: 'user_level',width:150,align:'center',hide:false,},
  {title: '服务', dataIndex: 'service_id',fixed: 'left',width:150,align:'center',hide:true,
  render: ({record}) => {
    if(columnsDistShow  && columnsDist.value.dicthelpApi_service){
      if(record.admin_service_id && record.admin_service_id != record.service_id){
        return h('div', [
          h('span',{style:{color:'red'}},getDictData('attrApi','dicthelpApi_service',record.admin_service_id,3,columnsDist.value)),
          h('br'),
          h('span',{style:{"text-decoration": "line-through",color:'#999999'}},record.service?.name),
        ])
		  }
      return record.service?.name
	  }
	}
  },
  {title: '状态', dataIndex: 'status',slotName: 'status',width:100,align:'center',hide:true,},
  {title: '地址库', dataIndex: 'address_lib_detail_id',slotName: 'address_lib_detail_id',width:100,align:'center',hide:true,},
  {title: '提单号', dataIndex: 'waybill_info',slotName: 'waybill_info',width:150,align:'center',hide:true,},
  {title: '主单号', dataIndex: 'ups',width:100,align:'center',hide:true,},
  {title: '收件人', ataIndex: 'name', slotName: 'name',width:70,align:'center',hide:true,},

  {title: '国家', dataIndex: 'country', slotName: 'country', width: 60, hide: true,},
  {title: '件数', dataIndex: 'parcel_count', width: 70, align: 'center', hide: true,
  render: ({record}) => {
    if (!record.volume_weight) {
      return ''
    }
    if (record.status == 1 || record.volume_weight.parcel_count == record.volume_weight.parcel_total) {
      return h('div',{style:{color:'#0ca90c'}},
                record.volume_weight?.parcel_total ?? ''
              )
    } else {
        return h('div',{style:{color:'red'}},
              record.volume_weight.parcel_count + '/' + record.volume_weight.parcel_total
            )
    }
	}

  },

  {title: '泡比', dataIndex: 'wv_rate',slotName: 'wv_rate',width:70,align:'center',hide:true,},
  {title: '收费重', dataIndex: 'charge_weight',slotName: 'charge_weight',width:70,align:'center',hide:true,},
  {title: '客户重量',dataIndex: 'client_weight', slotName: 'client_weight',width:70,align:'center',hide:true,},
  {title: '客户体积', dataIndex: 'client_volume',slotName: 'client_volume',align:'center',width:70,hide:true,},
  {title: '实重', dataIndex: 'actual_weight',slotName: 'actual_weight',width:70,align:'center',hide:true,},
  {title: '体积', dataIndex: 'actual_volume',slotName: 'actual_volume',width:70,align:'center',hide:true,},
  {title: '材重', dataIndex: 'actual_volume_weight',slotName: 'actual_volume_weight',width:70,align:'center',hide:true,},
  {title: '应收', dataIndex: 'income',slotName: 'income',width:160,align:'center',hide:auth('finance:customerFee:index'),settingHide: !auth('finance:customerFee:index'),},
  {title: '应付', dataIndex: 'expense',slotName: 'expense',width:160,align:'center',hide:auth('finance:supplierFee:index'),settingHide: !auth('finance:supplierFee:index'),},
  {title: '销售成本', dataIndex: 'cost',slotName: 'cost',width:100,align:'center',hide:auth('finance:cost:index'),settingHide: !auth('finance:cost:index'),},
  {title: '销售提成', dataIndex: 'bonus',slotName: 'bonus',width:100,align:'center',hide:auth('finance:bonus:index'),settingHide: !auth('finance:bonus:index'),},
  // {title: '应收', dataIndex: 'income',slotName: 'income',width:160,align:'center',hide:auditView.value,settingHide: !auditView.value,},
  // {title: '应付', dataIndex: 'expense',slotName: 'expense',width:160,align:'center',hide:auditView.value,settingHide: !auditView.value,},
  // {title: '销售成本', dataIndex: 'cost',slotName: 'cost',width:100,align:'center',hide:auditView.value,settingHide: !auditView.value,},
  // {title: '销售提成', dataIndex: 'bonus',slotName: 'bonus',width:100,align:'center',hide:auditView.value,settingHide: !auditView.value,},
  {
    title: '毛利',
    dataIndex: 'flow.rough_profit',
    width: 100,
    align: 'center',
    hide: authNode(['finance:customerFee:index', 'finance:supplierFee:index']),
    settingHide: !authNode(['finance:customerFee:index', 'finance:supplierFee:index'])
  },
  {
    title: '毛利率',
    dataIndex: 'flow.rough_profit_rate',
    width: 100,
    align: 'center',
    hide: authNode(['finance:customerFee:index', 'finance:supplierFee:index']),
    settingHide: !authNode(['finance:customerFee:index', 'finance:supplierFee:index'])
  },
  {
    title: '净利润',
    dataIndex: 'flow.net_profit',
    width: 100,
    align: 'center',
    hide: authNode(['finance:customerFee:index', 'finance:supplierFee:index', 'finance:bonus:index']),
    settingHide: !authNode(['finance:customerFee:index', 'finance:supplierFee:index', 'finance:bonus:index'])
  },
  {
    title: '销售利润',
    dataIndex: 'flow.sale_profit',
    width: 100,
    align: 'center',
    hide: authNode(['finance:customerFee:index', 'finance:cost:index']),
    settingHide: !authNode(['finance:customerFee:index', 'finance:cost:index'])
  },
  {title: '报关方式', dataIndex: 'exportwith', slotName: 'exportwith', width: 150, align: 'center', hide: true,},

  {
    title: '末端派送',
    dataIndex: 'end_delivery_type',
    slotName: 'end_delivery_type',
    width: 70,
    align: 'center',
    hide: true,
  },
  {
    title: '购买保险',
    dataIndex: 'insurance',
    width: 70,
    align: 'center',
  },
  {
    title: '标识', dataIndex: 'tags', slotName: 'tags', width: 70, align: 'center', hide: true,
    render: ({record}) => {
      if (columnsDistShow && record.tags.length > 0 && columnsDist.value.dicthelpApi_tags) {
        let attrsObj = getDictData('tags', 'dicthelpApi_tags', record.tags, 3, columnsDist.value)
        attrsObj = attrsObj.children.filter(person => person.type);
        return attrsObj
      }
    }

  },

  {title: 'FBA号', dataIndex: 'fba', slotName: 'fba', width: 70, align: 'center', hide: false,},
  {title: 'PO_Number', dataIndex: 'po_no', slotName: 'po_no', width: 70, align: 'center', hide: false,},

  // {title: '审计状态', dataIndex: 'is_audit',width:100,align:'center',hide:false,},
  // {title: '销售利润', dataIndex: 'sales_profit_amount',width:100,align:'center',hide:false,},
  // {title: '费用类型', dataIndex: 'fee_type',width:100,align:'center',hide:false,},
  // {title: '费用单位', dataIndex: 'unit',width:100,align:'center',hide:false,},


  {title: '预配货提单', dataIndex: 'container.container.public_number', width: 100, align: 'center', hide: true,},
  {
    title: '拣货站点',
    dataIndex: 'pickup_depot_id',
    slotName: 'pickup_depot_id',
    width: 100,
    align: 'center',
    hide: true,
  },
  {title: '预约送仓', dataIndex: 'to_depot_id',slotName: 'to_depot_id',width:100,align:'center',hide:true,},
  {title: '申报价值', dataIndex: 'declaration_value',slotName: 'declaration_value',width:100,align:'center',hide:true,},
  {title: '物品属性', dataIndex: 'attrs',width:100,align:'center',hide:true,
    render: ({record}) => {
      if (columnsDistShow && record.attrs.length > 0 && columnsDist.value.dictObj) {
        let attrsObj = getDictData('attrs', 'ShipmentAttrs', record.attrs, 3, columnsDist.value)
        attrsObj = attrsObj.children.filter(person => person.type);
        return attrsObj
      }
    }
  },
  {title: '销售代表', dataIndex: 'seller_id', slotName: 'seller_id', width: 100, align: 'center', hide: true,},
  {title: '财务代表', dataIndex: 'finance_id', slotName: 'finance_id', width: 100, align: 'center', hide: true,},
  {
    title: '客服代表',
    dataIndex: 'customer_service_id',
    slotName: 'customer_service_id',
    width: 100,
    align: 'center',
    hide: true,
  },
  {title: '分公司', dataIndex: 'organization_id',slotName: 'organization_id', width: 150, align: 'center', hide: true,},
  {title: '主品名', dataIndex: 'volume_weight.main_name',slotName: 'volume_weight.main_name', width: 150, align: 'center', hide: true,},
  {title: '供应商', dataIndex: 'supplier_desc',slotName: 'supplier_desc', width: 150, align: 'center', hide: true,},
  {title: '承运', dataIndex: 'carrier',slotName: 'carrier', width: 150, align: 'center', hide: true,},
  {title: '站点', dataIndex: 'depot_id', slotName: 'depot_id', width: 90, align: 'center', hide: true,},
  {title: '最后路由', dataIndex: 'last_route', slotName: 'last_route', width: 90, align: 'center', hide: true,},
  {title: '备注', dataIndex: 'remark', slotName: 'remark', width: 90, align: 'center', hide: true,},
  {title: '内部备注', dataIndex: 'internal_remark', slotName: 'internal_remark', width: 90, align: 'center', hide: true,},
  {title: '创建时间', dataIndex: 'created_at', width: 90, align: 'center', hide: true,},
  {title: '拣货时间', dataIndex: 'picking_at', width: 90, align: 'center', hide: true,},
  {title: '签收时间', dataIndex: 'delivered_at', width: 90, align: 'center', hide: true,},
  {title: '更新时间', dataIndex: 'updated_at', width: 90, align: 'center', hide: true, settingHide: false,},


  // {title: '操作', slotName: 'fixed',fixed: 'right',width: 107,align:'center'},
]);
//判断列表显示缓存
// localColumns(columnsData)
// console.log('lll',hhh)
const settingRef = ref()
const openSetting = () => {
  settingRef.value.open()
}
//新增
const addAction = () => {
  console.log('jjjjjjjjj', addModalMormRef.value)
  addModalMormRef.value.onShow()
}
//详情
const editAction = (record) => {
  shipmentInfo.value.onShow(record)
}

//搜索更多是否显示
const searchHide = ref(false)
//总页数
const pageInfo = ref({
  currentPage: 1,
  total: 0,
  totalPage: 1
})

//table 选择
const rowSelection = reactive({
  type: 'checkbox',
  showCheckedAll: true,
  checkStrictly: true
});
//列表请求数据
const formSearch = reactive(Object.assign({
  address_lib_detail_id_search: [],
  attrs: "",
  auditView: auditView.value,
  country_search: [],
  created_by: [],
  created_at: [],
  delivered_at: [],
  customer_service_id: [],
  depot_id: [],
  exportwith: "",
  finance_id: [],
  organization_id: [],
  page: 1,
  pageSize: 10,
  is_audit: [],
  pickup_depot_id: [],
  postcode: "",
  user_id: [],
  scence: "shipment",
  seller_id: [],
  service_ids: [],
  status: auditView.value ? '2' : '1',
  refresh_tabs: 1,
  taxwith: "",
  user_level: [],
  waybill_no: "",
  costomer_fee_amountMin: null,
  costomer_fee_amountMax: null,
  supplier_fee_amountMin: null,
  supplier_fee_amountMax: null,
  is_cost: '',
},getQuery()??{}))
const keywords_type = ref('keywords');
//审核状态
const auditType = reactive(
    [
      {label: '应收已审计', value: '1'},
      {label: '应收未审计', value: '2'},
      {label: '应付已审计', value: '3'},
      {label: '应付未审计', value: '4'},
      {label: '销售成本已审计', value: '5'},
      {label: '销售成本未审计', value: '6'},
      {label: '销售提成已审计', value: '7'},
      {label: '销售提成未审计', value: '8'},
    ]
)
//下拉框全选
const handleSelectAll = (status, list, type, typeStus) => {
  if (isUndefined(formSearch[type])) {
    formSearch[type] = []
  }
  console.log('jjj', typeStus)
  if (status) {
    let value = []
    list.map(item => {
      value.push(item[typeStus])
    })
    console.log('value', value)
    formSearch[type] = value
  } else {
    formSearch[type] = []
  }
}
//下拉框反选
const handleInverse = (list, type, typeStus) => {
  if (isUndefined(formSearch[type])) {
    formSearch[type] = []
  }
  const ids = []
  list.map(item => ids.push(item[typeStus]))
  formSearch[type] = xor(ids, formSearch[type])
}
const formSearchRef = ref(null)
//重置
const resetSearch = (e) => {
  formSearchRef.value.resetFields();
  console.log('formSearch', formSearch)
  for (const key in formSearch) {
        if (formSearch.hasOwnProperty(key)) {
          if(key !='auditView' && key !='page' && key !='pageSize' && key !='refresh_tabs' && key !='scence' && key !='status' && key!=''){
              formSearch[key]=null
          }
        }
    }
  tableList()
}
//搜索
const submitSearch = (e) => {
  formSearch.page = 1
  formSearch.refresh_tabs = 1
  searchHide.value = false
  tableList()
}

//切换分页
const pageChange = (e) => {
  if (e) {
    formSearch.page = e
    tableList()
  }
}
//切换条数
const pageSizeChange = (e) => {
  if (e) {
    tool.local.set('pageSize', e)
    formSearch.pageSize = e
    tableList()
  }
}
//行数选中
const setSelecteds = (key) => {
  console.log('key', key)
  selected.value = key
}
//tabs切换
const clickTap = (e) => {
  formSearch.page = 1
  formSearch.status = e
  formSearch.refresh_tabs = 0
  tableList()
}
    //列表
    const tableList = async () => {
      loading.value=true
      formSearch.pageSize=tool.local.get('pageSize') || 10
      let searchData = tool.cleanObject(formSearch)
      let res = await shipment.getList(searchData)
      if(res.code==200){
        dataList.value = res.data.items
        //页数
        pageInfo.value = res.data.pageInfo
        countList.value=res.data.count
        formSearch.status=res.data.current_type.toString()
        selected.value=[]
        loading.value=false
        tablePrantRefHeight(tablePrantRef.value)
        updateQuery(searchData,['status'])
      }
    }

    onMounted(() => {
      tableList()
    })




const downloadImportTemplate = async (type) => {
  let res = await shipment.downloadTemplate({type: type})
  let url = res.data.url
  let storeMode = 'OSS'

  Message.info('处理中...')
  const domain = uploadConfig.storage[storeMode]
  url = domain + url

  const response = await commonApi.download(url, 'get')
  if (response) {
    tool.download(response, (storeMode !== 'LOCAL') ? res.data.origin_name : '')
    Message.success('请求成功，文件开始下载')
  } else {
    Message.error('文件下载失败')
  }
}

const getChecked = (msg) => {
  console.log('getTableData', selected)
  // let select = JSON.parse(JSON.stringify(crudRef.value.getTableData().filter(i => selected.value.includes(i.id))))
  let select = JSON.parse(JSON.stringify(dataList.value.filter(i => selected.value.includes(i.id))))
  if (select.length < 2) {
    Message.error('请至少选择2个要' + msg + '的运单')
    return false
  }
  let data = []
  let defaultList = []
  select.map(i => {
    console.log(i)
    defaultList.push(i.id)
    data.push({
      title: i.shipment_no,
      formType: 'static-text',
    })
  })
  data.push({
    title: '',
    dataIndex: 'ids',
    multiple: true,
    formType: 'select',
    addDisplay: false,
    addDefaultValue: defaultList
  })
  return data
}

const splitShipment = () => {
  let data = getChecked('取消合并')
  if (data == false) return
  addModalRef.value.open(reactive(data), {
    viewType: 'modal',
  }, shipment.split, '取消合并', () => {
    tableList()
  })
}

const mergeShipment = () => {
  let data = getChecked('合并')
  if (data == false) return
  addModalRef.value.open(reactive(data), {
    viewType: 'modal',
  }, shipment.merge, '合并运单', () => {
    tableList()
  })
}
const searchSplit = () => {
  let data = getChecked('取消合并')
  if (data == false) return
  addModalRef.value.open(reactive(data), {
    viewType: 'modal',
  }, shipment.searchSplit, '取消合并')
}

const searchMerge = () => {
  let data = getChecked('合并')
  if (data == false) return
  addModalRef.value.open(reactive(data), {
    viewType: 'modal',
  }, shipment.searchMerge, '合并运单')
}

const formatDate = (date) => {
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的，所以加1
  const day = String(date.getDate()).padStart(2, '0');
  return `${year}-${month}-${day}`;
}

const synchronous = () => {
  // 获取当前日期
  const today = new Date();

// 获取上个月的日期
  const lastMonth = new Date(today.getFullYear(), today.getMonth() - 1, today.getDate());
  addModalRef.value.open(reactive([
        {
          title: "时间",
          dataIndex: "time",
          formType: "range",
          required: true,
          addDefaultValue: [formatDate(lastMonth), formatDate(today)],
          extra: '包含选择日期当天的运单,该任务为后台执行,5分钟后请手动刷新列表查看'
        },
        {
          title: "运单号",
          dataIndex: "shipment_no",
          formType: "input",
          extra: '不含空格换行,填写该值后,时间可不选'
        },
        {
          title: "客户名称",
          dataIndex: "name",
          formType: "input",
          extra: '填写全称不含空格换行'
        },
        {
          title: "状态",
          dataIndex: "status",
          formType: "radio",
          addDefaultValue: 1,
          dict: {
            data: [
              {label: "已下单", value: 1},
              {label: "已收货", value: 2},
              {label: "转运中", value: 3},
              {label: "已签收", value: 4},
            ]
          },
          type: 'button',
          required: true,
        },

      ]), {
        viewType: 'modal',
      }, shipment.synchronous, '新智慧运单同步', function () {
        tableList()
      }
  )
}

//打印入仓单
const printListTap = () => {
  let select = JSON.parse(JSON.stringify(dataList.value.filter(i => selected.value.includes(i.id))))
console.log('select',select)
  if (select.length ==0) {
    Message.error('请选择要打印的运单')
    return false
  }
  printListRef.value.onShow(select);

}
//导入
const importImport = (type) => {
  fileimportRef.value.onShow(type);

}
// const importList = (type) => {
//   addModalRef.value.open(reactive([
//     {
//       title: "用户",
//       dataIndex: "user_id",
//       formType: "select",
//       virtualListProps:{},
//       dict: {
//           data:columnsDist.value.dicthelpApi_customer.data,
//           props: {label: 'username', value: 'id'},translation: true,
//       },
//       required: true,
//     },
//     // {
//     //   title: "预约送仓",
//     //   dataIndex: "to_depot_id",
//     //   formType: "select",
//     //   virtualListProps:{},
//     //   dict: {
//     //     // 远程通用接口请求，新版代码生成都有一个 remote 接口
//     //     // url: 'warehouse/depot/list',
//     //     data:columnsDist.value.dicthelpApi_depot.data,
//     //     // 指定组件接收的props
//     //     props: {label: 'name', value: 'id'},
//     //     translation: true,
//     //   },
//     //   required: true,
//     // },
//     {
//       formType: 'grid-tailwind',
//       colNumber: 2,
//       cols: [
//         {
//           formList: [
//             {
//               title: "文件",
//               dataIndex: "file",
//               type: 'file',
//               formType: "upload",
//               multiple:true,
//               required: true,
//             },
//           ]
//         },
//         {
//           formList: [
//             {
//               title: '下载模板',
//               formType: 'button',
//               onClick: (from) => {
//                 downloadImportTemplate(type)
//               }
//             },
//           ]
//         },
//       ],
//     },
//     {
//       title: "类型",
//       dataIndex: "type",
//       type: 'hidden',
//       addDefaultValue: type,
//       addDisplay: false
//     },
//   ]), {
//     viewType: 'modal',
//   }, shipment.importExcel, type == 'shipment_excel' ? '导入运单' : '批量导入', function () {
//     tableList()

//   })
// }

const keywordTypes = [
  //  转单号   供应商单号
  {value: 'keywords', label: '关键字'},
  {value: 'shipment_no', label: '运单号'},
  {value: 'client_reference', label: '客户单号'},
  {value: 'ext_number', label: '扩展单号'},
]
const switchKeywordType = (form, value) => {
  keywordTypes.map(i => {
    if (form[i.value] && i.value !== value) {
      form[value] = form[i.value]
      form[i.value] = undefined
    }
  })
}

const changeStatusButtonText = computed(() => currentStatus.value != 3 ? '转运中' : '已签收')
const changeStatusApi = computed(() => currentStatus.value != 3 ? shipment.transhipment : shipment.sign)

const thirdOrder = ref([
  {
    title: '供应商',
    dataIndex: 'channel_id',
    formType: 'cascader',
    dict: {url: 'logistics/supplier/channel?type=13', translation: true,},
    rules: [
      {required: true, message: "请选择承运商"}
    ],
    onChange: (value, form) => {
      getThirdOrderForm(value, form)
    }
  },
])

const getThirdOrderForm = async (value, form) => {
  while (thirdOrder.value.length > 1) {
    thirdOrder.value.pop()
  }
  if (value) {
    Message.loading({content: '参数加载中...',duration:30000})
    let res = await shipment.getThirdOrderForm({channel_id: value})
    res.data.map(i => {
      thirdOrder.value.push(i)
      form.getColumnService().dicts[i.dataIndex] = i.dict?.data || []
    })
    Message.clear()
  }
}
const buttonGroups = [
  {
    title: '其他',
    action: '',
    hideStatus: [7],
    AuditShow: true,
    auth: ['document:shipment:pick', 'document:shipment:resend'],
    children: [
      {
        title: '按客户数据拣货',
        auth: ['document:shipment:pick'],
        api: shipment.pickByClient,
        hideStatus: [2, 4, 5, 6, 7, null]
      },
      // {title: '查看数据', action: ''},
      // {title: '比价', action: ''},
      {
        title: '标识', AuditShow: true, api: tag.set, hideStatus: [],
        form: {
          form: {
            about_type: 1
          },
          columns: [
            {
              title: '操作', dataIndex: 'type', formType: 'select', dict: {
                data: [
                  {label: '添加', value: 1},
                  {label: '移除', value: 2},
                  {label: '设置', value: 3},
                  {label: '清除全部', value: 4},
                ]
              },
              commonRules: {
                required: true,
                message: "请选择操作类型"
              },
            },
            {
              title: '标识', dataIndex: 'tag_ids', formType: 'checkbox', dict: {
                url: 'logistics/tag/list',
                props: {label: 'name', value: 'id'},
                translation: true,
                params: {
                  select: 'id,name',
                  type: 1
                }
              },
            },
          ]
        },
      },
      // {title: '拦截/问题件', action: ''},
      {title: '重新发货', auth: ['document:shipment:resend','document:shipment:changeShipmentStatus'], api: shipment.resend, hideStatus: [1, 2, 3, 4, 7, null],},
      // {title: '刷新最后路由', api: shipment.printInbound, hideStatus: [6, 7]},
    ]
  },
  {
    title: '打印标签', action: '', auth: ['logistics:printLabel:preview', 'logistics:printLabel:print'], children: [
      {title: '系统标签', auth: ['logistics:printLabel:preview'], api: printLabel.preview, isPrint: true},
      // {title: '派送标签', action: ''},
      // {title: '运单标签', action: ''},
      // {title: '运单文件', action: ''},
      // {title: 'FBA标签', action: ''},
      // {title: '快递发票', action: ''},
      // {title: '运单发票', action: ''},
      {
        title: '下载标签', auth: ['logistics:printLabel:print'], api: printLabel.print, isDownload: true, form: {
          form: {
            uploadType: '1',
            printType: '1'
          },
          columns: [
            {
              title: '选择数据',
              dataIndex: 'uploadType',
              formType: 'select',
              dict: {name: "uploadType", translation: true},
              rules: [
                {required: true, message: "请选择下载方式"}
              ]
            },
            {
              title: '标签类型',
              dataIndex: 'printType',
              formType: 'select',
              dict: {name: "printType", translation: true},
              rules: [
                {required: true, message: "请选择标签类型"}
              ]
            },
          ]
        }
      },
    ]
  },
  // {title: '打印入仓单', action: (v) => {console.log(v)}},
  // {title: '创建快递单', action: '', auth: '', hideStatus: [1, 4, 5, 6, 7]},
  // {title:'保险',action:'',hideStatus:[5,6,7]},
  {
    title: '配货',
    auth: ['document:delivery:addParcel', 'document:waybill:addParcel'],
    hideStatus: [5, 6, 7, null],
    children: [
      {
        title: '放入出货单', api: delivery.addParcelById, auth: ['document:delivery:addParcel'],
        form: {
          key: 'shipment',
          columns: [
            {
              title: '转运单', dataIndex: 'delivery_id', formType: 'select',
              rules: {required: true, message: "请选择转运单"},
              dict: Object.assign(dictHelp.delivery, {params: {scene: 'AddParcel'}})
            }
          ]
        }
      },
      {
        title: '放入提单', api: waybill.addParcelById, auth: ['document:waybill:addParcel'],
        displayDataIndex: "shipment_no", form: {
          key: 'shipment',
          columns: [
            {
              dataIndex: 'waybill_id', title: '提单号', formType: 'select',
              dict: Object.assign(dictHelp.waybillShouldSelect, {}),
              rules: {required: true, message: "请选择提单"},
            }
          ]
        }
      },
    ]
  },
  {
    title: '转运中', api: shipment.transhipment,auth: ['document:shipment:changeShipmentStatus'], hideStatus: [1, 3, 5, 6, 7, null],

  },
  {
    title: '退件', api: shipment.back, auth: ['document:shipment:changeShipmentStatus'],hideStatus: [1, 2, 3, 5, 6, 7, null], status: 'danger',
    form: {
      columns: [
        {
          title: '退件原因',
          dataIndex: 'return_remark',
          formType: 'textarea',
          rules: {required: true, message: "请填写退件原因"},
        },
      ]
    }
  },
  {
    title: '已签收', api: shipment.sign,auth: ['document:shipment:changeShipmentStatus'], hideStatus: [1, 2, 4, 5, 6, 7, null],
    form: {
      columns: [
        {
          title: '签收时间',
          dataIndex: 'delivered_at',
          formType: 'date',
          showTime: true,
          rules: {required: true, message: "请选择操签收时间"},
        },
        {
          title: '',
          dataIndex: 'update_route',
          formType: 'checkbox',
          dict: {
            data: [
              {label: '更新路由', value: '1'},
            ]
          }
        }
      ]
    }
  },
  // {title:'预约取件',action:'',hideStatus:[2,3,4,5,6,7]},
  {
    title: '批量修改',
    auth: ['document:shipment:updateBatch'],
    api: shipment.updateBatch,
    hideStatus: [5, 6, 7],
    AuditShow: true,
    form: {
      options: {
        layout: 'vertical'
      },
      form: {
        remark_type: 2,
        internal_remark_type: 2,
      },
      columns: [
        {
          formType: 'grid-tailwind',
          colNumber: 2,
          cols: [
            {
              formList: [
                {
                  title: '服务',
                  dataIndex: 'service_id',
                  formType: 'select',
                  dict: dictHelp.service,
                  virtualListProps: {},
                },
                {title: '预约送仓', dataIndex: 'to_depot_id', formType: 'select', dict: dictHelp.depot},
                // {title: '供应商服务', dataIndex: 'service_id',},
                {title: '销售代表', dataIndex: 'seller_id', formType: 'select', dict: dictHelp.user},
                {title: '客服代表', dataIndex: 'customer_service_id', formType: 'select', dict: dictHelp.user},
                {title: '财务代表', dataIndex: 'finance_id', formType: 'select', dict: dictHelp.user},
                {title: '归属分公司', dataIndex: 'organization_id', formType: 'select', dict: dictHelp.dept},
              ],
            },
            {
              formList: [
                {title: '关联单号', dataIndex: 'self_reference',},
                {title: '备注', dataIndex: 'remark', formType: 'textarea'},
                {
                  title: '备注选择',
                  dataIndex: 'remark_type',
                  formType: 'radio',
                  type: 'button',
                  dict: {data: [{label: '追加', value: 2}, {label: '覆盖', value: 1}]},
                },
                {title: '内部备注', dataIndex: 'internal_remark', formType: 'textarea'},
                {
                  title: '内部备注选择',
                  dataIndex: 'internal_remark_type',
                  formType: 'radio',
                  type: 'button',
                  dict: {data: [{label: '追加', value: 2}, {label: '覆盖', value: 1}]},
                },
              ]
            }
          ]
        }
      ]
    }
  },
  {
    title: '批量添加路由',
    action: '',
    hideStatus: [5, 6, 7],
    auth: ['routes:route:save'],
    api: route.save,
    form: {
      form: {
        route_1: "1",
        about_type: "App\\Document\\Model\\Shipment"
      },
      columns: [
        {
          dataIndex: "remark",
          title: "描述",
          formType: "input",
          addDisplay: false,
          rules: {required: true, message: "请输入描述"}
        },
        {
          title: "时间",
          formType: "date",
          showTime: true,
          dataIndex: "time",
          rules: {required: true, message: "请选择时间"}
        },
      ]
    }
  },
  // {title:'供应商互联',action:'',hideStatus:[5,6,7],children: [
  //     {title:'推送下单',action:''},
  //     {title:'更新订单',action:''},
  //     {title:'提取供应商重量收货',action:''},
  //     {title:'提取供应商重量',action:''},
  //     {title:'提取供应商转单号',action:''},
  //   ]},
  // {title:'导出',action:''},
  // {title:'查看统计',action:''},
  // {title:'重算',action:'',AuditShow:true},
  {
    title: '重算',
    auth: ['document:shipment:recalculation'],
    api: shipment.recalculation,
    AuditShow: true,
    hideStatus: [1, 5, 6, 7],
    form: {
      columns: [
        {
          title: '操作', dataIndex: 'types', formType: 'checkbox', dict: {
            name: 'recalculation'
          },
          rules: {required: true, message: "请选择操作类型"},
        },
      ]
    },
  },
  {
    title: '审计',
    auth: ['document:shipment:audit'],
    api: shipment.auditPass,
    AuditShow: true,
    hideStatus: [5, 6, 7],
    form: {
      columns: [
        {
          title: '操作', dataIndex: 'types', formType: 'checkbox', dict: {
            name: 'auditType'
          },
          rules: {required: true, message: "请选择操作类型"},
        },
      ]
    },
  },
  {
    title: '反审计',
    api: shipment.auditRefuse,
    auth: ['document:shipment:audit'],
    AuditShow: true,
    hideStatus: [5, 6, 7],
    form: {
      columns: [
        {
          title: '操作', dataIndex: 'types', formType: 'checkbox', dict: {
            name: 'auditType'
          },
          rules: {required: true, message: "请选择操作类型"},
        },
      ]
    },
  },
  {
    title: '问题件',
    api: workOrder.save,
    auth: ['logistics:workOrder:save'],
    AuditShow: true,
    hideStatus: [],
    form: {
      key: 'about_id',
      form: {
        title: '问题件',
        about_type: 1
      },
      columns: [
        {
          title: '标题', dataIndex: 'title', formType: 'input',
          rules: {required: true, message: "请填写标题"},
        },
        {
          title: '描述', dataIndex: 'remark', formType: 'textarea',
          rules: {required: true, message: "请填写描述"},
        },
        {
          title: "",
          dataIndex: "user_visible",
          formType: "checkbox",
          dict: {
            data: [
              {label: '用户可见', value: 1},
            ]
          },
        },
        {
          title: "",
          dataIndex: "intercept",
          formType: "checkbox",
          dict: {
            data: [
              {label: '拦截', value: 1},
            ]
          },
        },
      ]
    },
  },
  {
    title: '取消',
    api: shipment.cancel,
    status: 'danger',
    auth: ['document:shipment:cancel','document:shipment:changeShipmentStatus'],
    hideStatus: [2, 3, 4, 5, 6, null]
  },
  {
    title: '远程操作', action: '',
    auth: ['document:shipment:thirdOrder'],
    children: [
      {
        title: '远程下单', auth: ['document:shipment:thirdOrder'], api: shipment.thirdOrder, form: {
          columns: thirdOrder.value,
        },
        cancel: () => {
          getThirdOrderForm()
        }
      },
      {
        title: '更新拣货信息', auth: ['document:shipment:thirdOrderPick'], api: shipment.thirdOrderPick, form: {
          columns:[
            {
              title: '操作', dataIndex: 'type', formType: 'checkbox',
              dict: {
                data: [
                  {label: '提取供应商收费重', value: '1'},
                  {label: '按供应商重量收货', value: '2'},
                ]
              },
              // rules: {required: true, message: "请选择操作类型"},
            },
          ]
        }
      },
      {
        title: '更新路由', auth: ['document:shipment:thirdOrderRoute'], api: shipment.thirdOrderRoute, form: {}
      },
      {
        title: '获取转单号', auth: ['document:shipment:getTrackingNumbers'], api: shipment.getTrackingNumbers, form: {}
      },
    ]
  },
]
const buttonGroupForFees = [
  {
    title: '批量添加费用', action: '', hideStatus: [1, 5, 6, 7], auth: [
      'finance:customerFee:saveBatch',
      'finance:supplierFee:saveBatch',
      'finance:cost:saveBatch',
      'finance:bonus:saveBatch',
    ], children: [
      {
        title: '按单添加应收', api: customerFee.saveBatch, auth: ['finance:customerFee:saveBatch'], form: {
          form: {'invoices_type': 'shipment'}, submited: (data) => {
            console.log('hy', data)
          }
        }
      },
      {
        title: '应收', api: customerFee.saveBatch, auth: ['finance:customerFee:saveBatch'], form: {
          form: {'invoices_type': 'shipment'}, submited: (data) => {
            console.log(data)
          }
        }
      },
      {
        title: '应付', api: supplierFee.saveBatch, auth: ['finance:supplierFee:saveBatch'], form: {
          form: {'invoices_type': 'shipment'}, submited: (data) => {
            console.log(data)
          }
        }
      },
      {
        title: '销售成本', api: Cost.saveBatch, auth: ['finance:cost:saveBatch'], form: {
          form: {'invoices_type': 'shipment'}, submited: (data) => {
            console.log(data)
          }
        }
      },
      {
        title: '销售提成', api: Bonus.saveBatch, auth: ['finance:bonus:saveBatch'], form: {
          form: {'invoices_type': 'shipment'}, submited: (data) => {
            console.log(data)
          }
        }
      },
    ]
  },
]
const columnsDist = ref({})
const dictList = ref({})
const feeTypeList = ref({})
const supplierList = ref({})
const dicthelpApi_user = ref({})
useShipment(crudRef).then(res => {
  console.log('jjjj', res)
  columnsDist.value = res
  dictList.value = res.dictObj.data
  dicthelpApi_user.value = res.dicthelpApi_user.data
  feeTypeList.value = res.dicthelpApi_feeTypeList.data
  supplierList.value = res.dicthelpApi_supplier.data
  columnsDistShow.value = true
  let parcelType = res.dictObj.data.shipment_parcel_type
  if (parcelType) {
    let obj = {
      id: '',
      title: '全部',
      key: '',
    }
    if (auditView.value) {
      parcelType = parcelType.filter(person => person.key == '2' || person.key == '3' || person.key == '4' || person.key == '6')
    }
    parcelType.push(obj)
    shipmentTabs.value = parcelType
  }

})
provide('tableList', tableList);
provide('crudRef', crudRef)
provide('columnsData', columnsData)
provide('auditView', auditView)
provide('columnsDist', columnsDist)
provide('dataList', dataList)
provide('formSearch', formSearch)
provide('selected', selected)
provide('dictList', dictList) //全部字典
provide('dicthelpApi_user', dicthelpApi_user) //人員
provide('feeTypeList', feeTypeList) //费用类型
provide('supplierList', supplierList) //供应商

</script>

<style>
.form-inline-card > .arco-card-body {
  padding: 0;
  display: grid;
  grid: 1fr / 1fr 1fr 1fr;
}

.form-inline-card > .arco-card-header {
  display: none;
}

.fee-up {
  border-bottom: dashed #777777 1px;
}

.fee-down {
  color: orange;
}

.customer-input-item .arco-btn-group button:first-child {
  display: none;
}

/* .searchTop{
  display: flex;
  align-content: center;
  flex-direction:row;
  flex-wrap: wrap;
} */
.form-main {
  display: flex;
  height: 40px;
  overflow: hidden;
}

.searchHide {
  height: auto;
}

.boxShow {
  box-shadow: 0 10px 10px 10px #ccc;
}

.form-item {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  flex: 1;
}

.form-buttom {
  margin-left: 20px;
  width: 200px;
}

.searchTop-list {
  width: 20%;
}

.searchTop-list.tess {
  display: flex;
  margin-bottom: 20px;
}

@media (min-width: 601px) and (max-width: 1300px) {
  .searchTop-list {
    width: 50%;
  }
}

@media (min-width: 1301px) and (max-width: 1700px) {
  .searchTop-list {
    width: 33.33%;
  }
}

.top-button {
  display: flex;
  justify-content: space-between;
}

.top-button button {
  margin-right: 10px;
}

.table-list {
  margin-top: 5px;
}

.arco-tabs-content {
  padding: 0;
}

.foot-list {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.searchMain {
  position: relative;
}

.searchPos {
  position: absolute;
  left: 0;
  width: 100%;
  top: 0;
  z-index: 800;
  padding: 1rem 1rem 0;
  background: #ffffff;
}

.mainTable {
  padding-top: 68px;
}

.arco-select-view-inner {
  white-space: nowrap;
}

.arco-select-view-inner .arco-tag {
  white-space: nowrap !important;
}
.arco-table-element tbody{
  max-height: 100%;
  overflow: auto;
}
.tabs .arco-tabs-tab{
  min-width: 70px;
  justify-content: center;
}
.service .arco-cascader-panel{
  height: 500px;
  .arco-cascader-panel-column{
    max-height: 500px;
  }
}
/* 滚动条轨道 */
.table-list .arco-scrollbar-track-direction-horizontal {
  bottom: -13px;
}
</style>